package com.clwl.supervise.superviseapp.service.base;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.clwl.supervise.superviseapp.entity.base.JgMessage;
import com.clwl.supervise.superviseapp.mapper.base.JgMessageMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class SysNoticeService {

    @Resource
    private JgMessageMapper sysNoticeMapper;

    public List<JgMessage> selectMessageList(Integer pageNum, Integer pageSize) {
        Page<JgMessage> iPage = Page.of(pageNum, pageSize);
        iPage.setOptimizeCountSql(false);
        iPage.setSearchCount(false);
        QueryWrapper<JgMessage> sysNoticeQueryWrapper = new QueryWrapper<>();
        sysNoticeQueryWrapper.eq("status","2");
        IPage<JgMessage> sysNoticePage = sysNoticeMapper.selectPage( iPage,sysNoticeQueryWrapper);
        return sysNoticePage.getRecords();
    }

    public JgMessage selectMessageInfo(Long id) {
        return  sysNoticeMapper.selectById(id);
    }
}
